/**
 * 安卓白金英雄坛制作组 <br>
 * 文件名：EndlessBattle.java <br>
 * 创建时间：2014-8-12 下午1:17:14 <br>
 * 所属项目：GmudEX <br>
 * @author 12548 <br>
 */
package lostland.gmud.exv2.battle.proc.holder;

import lostland.gmud.exv2.Gmud;
import lostland.gmud.exv2.battle.BattleScreen;
import lostland.gmud.exv2.data.Npc;

/**
 * 类名：EndlessBattle <br>
 * 说明：生存模式
 *
 * @author ubun
 */
public class EndlessBattle extends BattleHolder {

	int i = 0;

	/* （非 Javadoc）
	 * @see lostland.gmud.exv2.expand.BattleHolder#updato()
	 */
	@Override
	void updato() {
		if (battle_stat == BATTLE_PLAYER1_WIN) {
			i++;
			BattleScreen.battle(-1, createMonster(i), this);
		} else {
			CommonBattle x = new CommonBattle();
			x.battle_stat = battle_stat;
			x.replaceCurrent();
		}
	}

	public int createMonster(int difficulty) {
		String slm[] = {"红色", "绿色", "蓝色", "橙色", "青色", "灰色", "紫色", "咖啡色", "雪青色", "白色", "黑色"};
		String name = slm[(int) (Math.random() * slm.length)] + "史莱姆";
		if (Gmud.findNpc("史莱姆") == null) {
			Npc npc = new Npc();
			Gmud.getNpc().add(npc);
			npc.name = name;
//			npc.id = GmudWorld.npc.size() - 1;
		}
		Npc m = Gmud.findNpc("史莱姆");
		m
				.name(name)
				.looklike((int) (Math.random() * 137))
				.flag(Npc.FLAG_SPOUSE);

		m.copy(Gmud.mc);
		m.setZoomSkill(m.skills, difficulty + 0.1);
		m.setExp(m.exp * difficulty / 2);
		return m.id;
	}
}
